package com.cm.api.controller;

import com.cm.api.service.UserService;
import com.cm.common.core.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @类 名：IndexController </br>
 * @描 述：</br>
 * @日 期：2020/9/2 23:08</br>
 * @作 者：常明</br>
 * @版 本：1.0.0
 * @since JDK 1.8
 */
@RestController
public class IndexController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    public Result login(String username, String password){
        if (userService.login(username,password))
            return Result.success();
        else
            return Result.error("登录失败");
    }
}
